// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license

@mixin nubbin($position: bottom, $location: "after", $color: $color-background-alt, $size: $nubbin-size-default) {

  &:#{$location} {
    @include square($size);
    position: absolute;
    transform: rotate(45deg);
    content: '';
    background-color: $color;

    @if $position == top {
      /*! @noflip */
      left: 50%;
      top: (($size * 0.5) * -1);
      /*! @noflip */
      margin-left: (($size * 0.5) * -1);
    }

    @else if $position == bottom {
      /*! @noflip */
      left: 50%;
      bottom: (($size * 0.5) * -1);
      /*! @noflip */
      margin-left: (($size * 0.5) * -1);
    }

    @else if $position == left {
      top: 50%;
      /*! @noflip */
      left: (($size * 0.5) * -1);
      margin-top: (($size * 0.5) * -1);
    }

    @else if $position == right {
      top: 50%;
      /*! @noflip */
      right: (($size * 0.5) * -1);
      margin-top: (($size * 0.5) * -1);
    }
  }
}

@mixin popover($color: $color-background-alt, $shadow: null) {
  position: relative;
  border-radius: $border-radius-medium;
  width: $size-medium;
  min-height: ($nubbin-size-default * 2);
  z-index: var(--slds-c-popover-position-zindex, $z-index-dialog);
  background-color: $color;
  display: inline-block;

  @if $shadow != null {
    box-shadow: $shadow;
  }
}
